package com.heima.feigns;

import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.ArticleFeignFallback;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(
        value = "leadnews-author",
        fallbackFactory = ArticleFeignFallback.class,
        configuration = HeimaFeignAutoConfiguration.class
)
public interface ApAuthorFeign {
    //根据ApUser id查询作者信息
    @GetMapping("/api/v1/author/findByUserId/{userId}")
    ResponseResult<ApAuthor> findByUserId(@PathVariable("userId") Integer userId);

    //保存作者信息
    @PostMapping("/api/v1/author/save")
    ResponseResult<ApAuthor> save(@RequestBody ApAuthor apAuthor);

    //根据articleId查询文章信息
//    @GetMapping("/api/v1/article/one")
//    @ApiOperation("根据articleId查询文章信息")
//    public ResponseResult<ApArticle> one(@RequestParam Long id);
}
